import type { FileSystemItem } from "../types/fileSystem";
import { businessFileSystemData } from "./businessData";
import { testFileSystemData } from "./testData";
import { DATA_CONFIG } from "../config/dataConfig";

// 合并数据源
function mergeFileSystemData(): Record<string, FileSystemItem[]> {
  let data = { ...businessFileSystemData };

  // 根据配置决定是否添加测试数据
  if (DATA_CONFIG.enableTestData && DATA_CONFIG.enableLargeDataTest) {
    // 添加测试文件夹到桌面
    if (data["/C:/Users/Administrator/Desktop"]) {
      data["/C:/Users/Administrator/Desktop"].push(
        {
          name: "大文件列表测试",
          type: "folder",
          lastModified: new Date("2024-01-22"),
          children: [],
        },
        {
          name: "超大文件列表测试",
          type: "folder",
          lastModified: new Date("2024-01-22"),
          children: [],
        }
      );
    }

    // 合并测试数据
    data = { ...data, ...testFileSystemData };
  }

  return data;
}

// 导出最终的文件系统数据
export const fileSystemData = mergeFileSystemData();
